package BaseObject;

/**
 * ClassName: HanNuoTa
 * Package: BaseObject
 * Description: 汉诺塔
 *
 * @Author Linshio
 * @Create 2025/3/10 21:42
 */
public class HanNuoTa {
    public static void main(String[] args) {
        move(2, 'A', 'B', 'C');
    }

    /**
     * @param num
     * @param a
     * @param b
     * @param c
     */
    static void move(int num, char a, char b, char c) {
        if (num == 1) {
            System.out.println(a + "->" + c);
        } else {
            move(num - 1, a, c, b);
            System.out.println(a + "->" + c);
            move(num - 1, b, a, c);
        }
    }
}


